package com.wsoft.hr.pm.manager;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wsoft.hr.pm.entity.HrPmWarningEntity;
import com.wsoft.hr.pm.mapper.HrPmWarningMapper;
import com.wsoft.hr.pm.query.warning.WarningListQuery;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author z001
 * @Date 2025/3/7 14:35
 */
@Slf4j
@Service
public class HrPmWarningManager extends ServiceImpl<HrPmWarningMapper, HrPmWarningEntity> {


    /**
     * 查询列表
     * @param param
     * @return
     */
    public List<HrPmWarningEntity> list(WarningListQuery param){
        QueryWrapper<HrPmWarningEntity> query = new QueryWrapper<>();
        query.lambda()
                .eq(StrUtil.isNotBlank(param.getType()),HrPmWarningEntity::getType,param.getType())
                .like(StrUtil.isNotBlank(param.getTitle()),HrPmWarningEntity::getTitle,param.getTitle())
                .ge(StrUtil.isNotBlank(param.getBeginTime()),HrPmWarningEntity::getCreateTime,param.getBeginTime())
                .le(StrUtil.isNotBlank(param.getEndTime()),HrPmWarningEntity::getCreateTime,param.getEndTime());
        return list(query);
    }
}
